package edu.sctu.wulixia.month6.day20150615;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Created by user05 on 2015/6/16.
 */
public class BufferWriteTest {
    public  void setMess() throws IOException {
        FileWriter fileWriter = new FileWriter("D://wulixia//www.txt");
        BufferedWriter buf = new BufferedWriter(fileWriter);

        for (int i = 0; i < 5 ; i++) {
            buf.write(Double.toString(Math.random()));//写入随机数到缓冲区
            buf.newLine();//写入换行符
        }
        buf.flush();//将缓冲区的数据写到文件
        fileWriter.close();
    }
}
